package com.jrx.anytxn.atom.service;

import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.transaction.constant.TransBizConstant;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: anytxn-cf-parent
 * @description:
 * @author: xiaoyu.jing
 * @date: 2020-08-25 16:05
 **/
public abstract class BaseBatchAccoutHandle<T> {

    @Resource
    private IAfterHandleService commonAfterHandleService;

    /**
     * 业务逻辑处理
     *
     * @return
     * @throws TxnException
     */
    public abstract List<T> handBatchAccout() throws Exception;

    /**
     * 处理后对象转换
     *
     * @param list
     * @throws Exception
     */
    public void afterHandle(List<T> list) throws Exception {
        commonAfterHandleService.afterHandle(list);
    }

    /**
     * 获取批次类型
     *
     * @return
     */
    public String getBatchType() {
        return TransBizConstant.BATCH_TYPE_0;
    }

}
